﻿using System.Collections.Generic;

namespace OestsCommon.Model
{
    public class ExamLog
    {
        /// <summary>
        ///  理论试题ID 或者 任务ID
        /// </summary>
		public int SubjectId { get; set; }

        /// <summary>
        /// 理论题：List[Char] 答案 操作题任务 该数据为空
        /// </summary>
        public List<string> Answer { get; set; }

        /// <summary>
        /// 答题结果 正确与错误
        /// </summary>
        public bool Result { get; set; }

        public ExamLog()
        {

        }
        public ExamLog(int id, List<string> answer)
        {
            SubjectId = id;
            Answer = answer;

        }
    }

    public class ExamLogComparer : IEqualityComparer<ExamLog>
    {
        public bool Equals(ExamLog x, ExamLog y)
        {
            if (object.ReferenceEquals(x, y)) return true;
            return x != null && y != null && x.SubjectId.Equals(y.SubjectId) && x.Answer.Equals(y.SubjectId);
        }

        public int GetHashCode(ExamLog obj)
        {
            int hashid = obj.SubjectId.GetHashCode();
            int hashanswer = obj.Answer.GetHashCode();

            return hashid ^ hashanswer;

        }
    }
}
